package com.webfinal.backsystem.controller;

import com.webfinal.backsystem.request.activity.ActivityInfoRequest;
import com.webfinal.backsystem.request.activity.ActivityProdRequest;
import com.webfinal.backsystem.request.activity.AddActivityProdRequest;
import com.webfinal.backsystem.response.activity.ActivityInfoResponse;
import com.webfinal.backsystem.response.activity.ActivityProdResponse;
import com.webfinal.backsystem.response.activity.AddActivityProdResponse;
import com.webfinal.backsystem.service.ActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
public class ActivityController {
    @Autowired
    private ActivityService activityService;

    @RequestMapping(value = "/api/activity/allactivity")
    public ActivityInfoResponse allactivity(){
        return activityService.allactivity();
    }

    @RequestMapping(value = "/api/activity/searchbyname")
    public ActivityInfoResponse searchactivity(@RequestBody ActivityInfoRequest activityInfoRequest){
        return activityService.activitybyname(activityInfoRequest);
    }

    @RequestMapping(value = "/api/activity/addactivity")
    public ActivityInfoResponse addactivity(@RequestBody ActivityInfoRequest activityInfoRequest){
        return activityService.addactivity(activityInfoRequest);
    }
    @RequestMapping(value = "/api/activity/searchactivityproduct")
    public ActivityProdResponse searchactivityproduct(@RequestBody ActivityProdRequest activityProdRequest){
        return activityService.searchactivityprod(activityProdRequest);
    }

    @RequestMapping(value = "/api/activity/addactivityprod")
    public AddActivityProdResponse addactivityprod(@RequestBody AddActivityProdRequest addActivityProdRequest){
        return activityService.addactivityprod(addActivityProdRequest);
    }

}
